@model ZKEACMS.FormGenerator.Models.FormField
@{
    List<SelectListItem> items = new List<SelectListItem>();
    string province = null;
    string city = null;
    string district = null;
    if (Model.Value.IsNotNullAndWhiteSpace())
    {

        string[] dist = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(Model.Value);
        if (dist.Length > 0 && dist[0].IsNotNullAndWhiteSpace())
        {
            province = dist[0];
        }
        if (dist.Length > 1 && dist[1].IsNotNullAndWhiteSpace())
        {
            city = dist[1];
        }
        if (dist.Length > 2 && dist[2].IsNotNullAndWhiteSpace())
        {
            district = dist[2];
        }

    }
    Model.Attributes.TryAdd("data-province", province ?? L("-- 选择省 --").Text);
}
<div class="form-group size-@Model.Size">
    @if (Model.DisplayName.IsNotNullAndWhiteSpace())
    {
        <label class="control-label" for="@Model.ID">
            @Model.DisplayName
            @if (Model.IsRequired)
            {
                <span class="required">*</span>
            }
        </label>
    }
    <div class="row" data-toggle="distpicker">
        <div class="col-md-4">
            @Html.DropDownList(Model.ID + "[0]", items, Model.Attributes)
        </div>
        <div class="col-md-4">
            @Html.DropDownList(Model.ID + "[1]", items, new Dictionary<string, object> { { "class", "form-control" }, { "data-city", city ?? L("-- 选择市 --").Text } })
        </div>
        <div class="col-md-4">
            @Html.DropDownList(Model.ID + "[2]", items, new Dictionary<string, object> { { "class", "form-control" }, { "data-district", district ?? L("-- 选择区 --").Text } })
        </div>
    </div>

    <span class="field-validation-valid" data-valmsg-for="@(Model.ID + "[0]")" data-valmsg-replace="true"></span>
    @if (Model.Description.IsNotNullAndWhiteSpace())
    {
        <dl>
            <dd>
                @Model.Description
            </dd>
        </dl>
    }
</div>